package com.douqu.game.battle.entity.aobject;

/**
 * BUFF的属性值
 * @Author: Bean
 * @Description:
 * @Date: 2017-11-28 11:28
 */
public class BattleAtt {

    /**
     * 基础值
     */
    public long base;

    /**
     * 加成值(只针对直接加属性的BUFF)
     */
    public long plus;

    /**
     * 其它类型的加成
     */
    public long extPlus;

    public long min;

    public BattleAtt(long base, int min)
    {
        this.base = base;
        this.min = min < 0 ? min + Math.abs(base) : min;
    }

    public void addExtPlus(int value)
    {
        extPlus += value;
    }

    public void addPlus(int value)
    {
        if(value == 0)
            return;

        plus += value;
        plus = plus < min-base ? min-base : plus;
    }

    public static void main(String[] args) {
        int v = 20000;
        int p = 0;
        int b = 3000;
        p += v;
        int m = Integer.MIN_VALUE;
        BattleAtt ba = new BattleAtt(b, m);

        ba.addPlus(v);

        System.out.println(ba.getAtt());
    }

    public void setPlus(int value)
    {
        plus = 0;
        addPlus(value);
    }

    public long getAtt()
    {
        return base + plus;
    }


    @Override
    public String toString() {
        return "{" +
                "base=" + base +
                ", plus=" + plus +
                '}';
    }
}
